package com.gamejelly.broker.client;

import com.alipay.remoting.exception.RemotingException;
import com.gamejelly.broker.message.RegisterMsg;
import com.gamejelly.broker.message.RpcMessage;

import java.lang.reflect.InvocationTargetException;

public interface BrokerClient extends RpcManager {

    static BrokerClientImpl.ClientBuilder builder() {
        return new BrokerClientImpl.ClientBuilder();
    }

    void init() throws RemotingException, InterruptedException;

    String getBrokerAddress();

    String registerTo(RegisterMsg msg) throws RemotingException, InterruptedException;

    void handle(RpcMessage rpcMessage) throws InvocationTargetException, IllegalAccessException;

    void connected(String hostString);

    void reply(RpcMessage data, Object o) throws RemotingException, InterruptedException;
}
